package sync.hw.teacher.demo02;

/**
 * @author lwj
 * @date 2025-03-13
 * @vesion 1.0.0
 */
public class Printer {
    /**
     * 打印
     *
     * @param user 使用者
     * @param msg  内容
     */
    public synchronized void print(String user,String msg){
        System.out.print(user);

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.print(":");
        System.out.print(msg);
    }
}
